<!-- 权限管理 -->
<div data-ng-controller="RolesCtrl">
    <ul class="nav nav-pills">
        <li ng-class="{'active':active_tab=='all' || active_tab==null}">
            <a ng-click="switchTab('all')">概览</a>
        </li>
        <li ng-class="{'active':active_tab=='role'}">
            <a ng-click="switchTab('role')">职位</a>
        </li>
        <li ng-class="{'active':active_tab=='permission'}">
            <a ng-click="switchTab('permission')">权限</a>
        </li>
        <li ng-class="{'active':active_tab=='resource'}">
            <a ng-click="switchTab('resource')">资源</a>
        </li>
    </ul>
    <!-- 职位管理 -->
    <div ng-if="active_tab=='role'" style="margin: 30px 50px">
        <button type="button" class="btn btn-primary" ng-click="createRole()">创建职位</button>
        <table class="table table-responsive" style="margin: 15px 0 0 0;font-size: 12pt">
            <thead>
            <tr>
                <th><a style="cursor: pointer" ng-click="setOrderRuleRole('id')">ID</a></th>
                <th><a style="cursor: pointer" ng-click="setOrderRuleRole('type')">类型</a></th>
                <th><a style="cursor: pointer" ng-click="setOrderRuleRole('name')">名称</a></th>
                <th><a style="cursor: pointer" ng-click="setOrderRuleRole('description')">描述</a></th>
                <th><a style="cursor: pointer" ng-click="setOrderRuleRole('available')">状态</a></th>
                <th><a>-||-</a></th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="r in roleQuery.data | orderBy:orderRuleRole">
                <td>{{r.id}}</td>
                <td>{{r.type}}</td>
                <td>{{r.name}}</td>
                <td>{{r.description}}</td>
                <td>{{r.available?'可用':'锁定'}}</td>
                <td>
                    <div class="btn-group" uib-dropdown>
                        <a uib-dropdown-toggle>
                            编辑 <span class="caret"></span>
                        </a>
                        <ul class="dropdown-menu" uib-dropdown-menu>
                            <li><a href="#">查看</a></li>
                            <li><a ng-click="alterRole(r)">修改</a></li>
                            <li><a ng-click="removeRole(r)">移除</a></li>
                        </ul>
                    </div>
                </td>
            </tr>
            </tbody>
        </table>
        <ul class="pagination pagination-sm pull-right" ng-repeat="num in roleQuery.pageNumbers">
            <li><a ng-click="listRoles(num)">{{num}}</a></li>
        </ul>
    </div>
    <!-- 权限管理 -->
    <div ng-if="active_tab=='permission'" style="margin: 30px 50px">
        <button type="button" class="btn btn-primary" ng-click="createPermission()">创建权限</button>
        <table class="table table-responsive" style="margin: 15px 0 0 0;font-size: 12pt">
            <thead>
            <tr>
                <th><a style="cursor: pointer">职位</a></th>
                <th><a style="cursor: pointer">资源</a></th>
                <th><a style="cursor: pointer">权限</a></th>
                <th><a style="cursor: pointer">状态</a></th>
                <th><a>-||-</a></th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="p in permissionQuery.data">
                <td>{{p.roleDescription}}</td>
                <td>{{p.resourceName}}</td>
                <td>{{p.permission}}</td>
                <td>{{p.available?'可用':'锁定'}}</td>
                <td>
                    <div class="btn-group" uib-dropdown>
                        <a uib-dropdown-toggle>
                            编辑 <span class="caret"></span>
                        </a>
                        <ul class="dropdown-menu" uib-dropdown-menu>
                            <li><a href="#">查看</a></li>
                            <li><a ng-click="alterPermission(p)">修改</a></li>
                            <li><a ng-click="removePermission(p)">移除</a></li>
                        </ul>
                    </div>
                </td>
            </tr>
            </tbody>
        </table>
        <ul class="pagination pagination-sm pull-right" ng-repeat="num in permissionQuery.pageNumbers">
            <li><a ng-click="listPermissions(num)">{{num}}</a></li>
        </ul>
    </div>
    <!-- 资源管理 -->
    <div ng-if="active_tab=='resource'" style="margin: 30px 50px">
        <button type="button" class="btn btn-primary" ng-click="createResource()">创建资源</button>
        <table class="table table-responsive" style="margin: 15px 0 0 0;font-size: 12pt">
            <thead>
            <tr>
                <th><a>名称</a></th>
                <th><a>类型</a></th>
                <th><a>描述</a></th>
                <th><a>状态</a></th>
                <th><a>-||-</a></th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="r in resourceQuery.data">
                <td>{{r.name}}</td>
                <td>{{r.type}}</td>
                <td>{{r.description}}</td>
                <td>{{r.available?'可用':'锁定'}}</td>
                <td>
                    <div class="btn-group" uib-dropdown>
                        <a uib-dropdown-toggle>
                            编辑 <span class="caret"></span>
                        </a>
                        <ul class="dropdown-menu" uib-dropdown-menu>
                            <li><a href="#">查看</a></li>
                            <li><a ng-click="alterResource(r)">修改</a></li>
                            <li><a ng-click="removeResource(r)">移除</a></li>
                        </ul>
                    </div>
                </td>
            </tr>
            </tbody>
        </table>
        <ul class="pagination pagination-sm pull-right" ng-repeat="num in resourceQuery.pageNumbers">
            <li><a ng-click="listResources(num)">{{num}}</a></li>
        </ul>
    </div>
</div>